package com.example.demo.Controller;

import com.example.demo.Service.BookService;
import com.example.demo.enums.ResultCode;
import com.example.demo.model.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;
import java.util.List;

@Slf4j
@RestController
@RequestMapping("/userInfo")
public class BookListController {
private static  String USER = "user";
    @Autowired
    BookService bookService;
    @RequestMapping("/getBooklist")
    public Result getLists(ListInfoMoke listInfoMoke, HttpSession session){
        log.info("登录校验");
        Result result = new Result();
       /* User user =(User)session.getAttribute(USER);
        if(user==null||user.getId()<=0) {
            log.info("未登录");
         result =  Result.unlogin();
         return result;
        }*/
        log.info("登录成功");

       ListInfo<BookInfo> listInfo1 = bookService.getLists(listInfoMoke);
        result = Result.success(listInfo1);
        System.out.println(result);
        return result;


    }
}
